#! /usr/bin/python

import math
import time

t = time.time()
result = 0
count = 0
k = 2

x0 = 9
y0 = 4

x1 = x0
y1 = y0

while(count < 6):
   result += x1**2 + 5*y1**2 - 4*x1*y1
   result += x1**2 + 5*y1**2 + 4*x1*y1   
   oldx = x1
   oldy = y1
   x1 = oldx*x0 + 5*oldy*y0
   y1 = oldx*y0 + x0*oldy
   count += 1

print result
print time.time() - t

